/**
 *
 */
package com.guchenbo.example.jpa;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.sql.SQLException;

/**
 * @author Cre.Gu
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({ "classpath:/applicationContext-jpa.xml" })
public class SpringJpaTest extends AbstractJUnit4SpringContextTests {

	@Test
	public void test() {
		System.out.println();

		ComboPooledDataSource dataSource = applicationContext.getBean("dataSource", ComboPooledDataSource.class);
		Assert.assertNotNull(dataSource);

		try {
			dataSource.getConnection();
		} catch (SQLException e) {
			e.printStackTrace();

		}
	}
}
